/*
 * @lc app=leetcode.cn id=478 lang=golang
 *
 * [478] 在圆内随机生成点
 */
package Solutions

import (
	"math"
	"math/rand"
)

// @lc code=start
type Solution struct {
	radius   float64
	x_center float64
	y_center float64
}

func Constructor____(radius float64, x_center float64, y_center float64) Solution {
	return Solution{
		radius:   radius,
		x_center: x_center,
		y_center: y_center,
	}
}

func (this *Solution) RandPoint() []float64 {
	de := rand.Float64() * 2 * math.Pi
	x := math.Cos(de)
	d2 := rand.Float64() * 2 * math.Pi
	y := math.Sin(d2) * math.Sin(de)
	return []float64{x*this.radius + this.x_center, y*this.radius + this.y_center}
}

/**
 * Your Solution object will be instantiated and called as such:
 * obj := Constructor(radius, x_center, y_center);
 * param_1 := obj.RandPoint();
 */
// @lc code=end
